function kte = computeKte(i,elements,model)
e = model.getElement(i-1);
f = e.getFace();
xi = e.getGaussPoint(0);
w = e.getGaussWeight(0);
jac = e.getFace().jacXAt(xi);
detJac = det(jac);
B = zeros(3,6);
B = e.computeB(f,B,xi);
C = elements(i).constitutiveMatrix;
if elements(i).isCrack==1
    kte = w*B'*C*B*abs(detJac);
    %elements(i).Kdxi
    %elements(i).Kxid
    %elements(i).Kxixi
    kte = kte-elements(i).Kdxi*...
        inv(elements(i).Kxixi)*elements(i).Kxid;
else
    kte = w*B'*C*B*abs(detJac);
end
end
